fix(policies): prevent binary content parsing for HELM_CHART materials#2683
fix(policies): prevent binary content parsing for HELM_CHART materials#2683Piskoo wants to merge 4 commits intochainloop-dev:mainfrom
Conversation
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
|
Thank you for the PR. Do you mind creating an issue explaining the problem and when it happens? Because in Helm charts we support both OCI and tarballs. Does this happen with other artifacts as well? |
|
|
|
||
| if artifact != nil { | ||
| if m.InlineCas { | ||
| if m.InlineCas && m.MaterialType != v1.CraftingSchema_Material_HELM_CHART { |
There was a problem hiding this comment.
so this means taht the helm chart no longer get stored?
There was a problem hiding this comment.
It is, I just tested it, which leads to another bug. Helm charts stored inline cannot be properly marshaled, created a task #2685
|
I don't understand how an issue in the policy engine requires changing if/when to store an artifact? |
We don't change WHEN it is stored, we change WHAT is being passed for the evaluation. For evaluations we accept only json content, for xml we marshal it into json first for processing. The same thing was being done for helm charts, we took binary content and tried to marshal into json before passing to policy engine, hence the issue. For non inline backends it was already excluded, with this PR it is being also excluded for the inline backend. |
Ah, I missunderstood, your response, sorry. So what happens if you have a |
It will fail in the same place, where we would try to marshal binary into json content. Kind detection works correctly for helm charts, so that will only happen if the user tries to evaluate helm chart that was explicitly passed as |
Hmm have a look at the WASM engine because that engine allows to pass any format, including raw bytes to the policy. |
|
I am closing it because I think this is a more wirespread problem that needs to be solved #2065 |
When using inline CAS storage,
HELM_CHARTmaterials containing binary data were incorrectly passed to JSON decoder, causing errors during policy evaluation.Closes #2684